import Vue from 'vue'
import VueRouter from 'vue-router'
// 一级路由
import Login from '@/views/login.vue'
import Layout from '@/views/layout.vue'
import Find from '@/views/find.vue'
import Consult from '@/views/consult.vue'
import User from '@/views/user.vue'
import Index from '@/views/index.vue'
import City from '@/views/city.vue'
import House from '@/views/house.vue'
import Map from '@/views/map.vue'
const My = () => import('@/views/my.vue')

Vue.use(VueRouter)

const routes = [
  { path: '/login', component: Login },
  { path: '/city', component: City },
  { path: '/house', component: House },
  { path: '/map', component: Map },
  {
    path: '/',
    component: Layout,
    redirect: '/index',
    children: [
      { path: 'index', component: Index },
      { path: 'find', component: Find },
      { path: 'consult', component: Consult },
      { path: 'user', component: User },
      { path: 'my', component: My }
    ]
  }
]

const router = new VueRouter({
  routes
})

export default router
